package com.ostrich.shopping.ui.user.viewmodel;

import com.ostrich.shopping.net.BaseResponseEntity;
import com.ostrich.shopping.room.User;
import com.ostrich.shopping.ui.user.entity.UserEntity;
import com.ostrich.shopping.ui.user.repository.UserRepository;

import java.util.List;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.ViewModel;

/**
 * @Author : yaotianxue
 * @Time : On 2023/9/26 15:26
 * @Description : RegisterViewModel
 */
public class LoginViewModel extends ViewModel {
    private UserRepository mUserRepository = new UserRepository();
    public LiveData<BaseResponseEntity<UserEntity>> login( String nickname, String password){
        return mUserRepository.login(nickname,password);
    }


    //插入用户
    public void insert(User user){
        mUserRepository.insert(user);
    }
    //查询用户
    public List<User> getAll(){
        return mUserRepository.getAll();
    }
}
